package pe.edu.upc.dsd.esb.whereeat.component.social;

import java.util.Set;

import org.apache.log4j.Logger;
import org.mule.RequestContext;
import org.mule.api.MuleContext;
import org.mule.api.MuleEvent;
import org.mule.api.MuleMessage;
import org.springframework.stereotype.Component;

import pe.edu.upc.dsd.esb.whereeat.component.AbstractComponent;
import com.restfb.types.User;

@Component
public class FacebookUserComponent extends AbstractComponent {

	private Logger logger = Logger.getLogger(FacebookUserComponent.class);

	public void saveUserFacebook(User user) {
		MuleEvent muleEvent = RequestContext.getEvent();
		MuleMessage message = muleEvent.getMessage();
		System.out.println(":: saveUserFacebook :: " + user.getId());
		System.out.println(":: saveUserFacebook :: " + user.getName());
		System.out.println(":: saveUserFacebook :: " + user.getEmail());
		System.out.println(":: saveUserFacebook :: " + user.getLocale());
	}

	public void saveUserFacebook(String payload) {
		MuleEvent muleEvent = RequestContext.getEvent();
		MuleMessage message = muleEvent.getMessage();
		Set<String> strings = message.getInboundPropertyNames();
		for (String string : strings) {
			System.out.print(string + " ====");
			System.out.println(message.getInboundProperty(string));
		}
	}

}
